1. Field of the Invention
The present invention relates generally to a communication device, and more particularly, to a communication device comprising a utilization portion for performing arbitrary application processing, a control portion for performing processing in accordance with a previously determined protocol, and a memory which is shared between the utilization portion and the control portion, a communication method, and a medium on which a computer program for carrying out the method is recorded.
2. Description of the Background Art
In a communication device comprising a utilization portion for performing arbitrary application processing, a control portion for performing processing in accordance with a previously determined protocol, and a memory which is shared between the utilization portion and the control portion, the control portion transmits transmit data generated in the utilization portion in accordance with the previously determined communication protocol. In the communication device, when large amounts of transmit data are generated in the utilization portion for a short time period at a speed exceeding the communication speed of the control portion, the transmit data may be discarded without being transmitted. Therefore, the conventional communication device has a transmission buffer provided therein, and employs a method of temporarily storing transmit data in the transmission buffer to absorb the overflow of the transmit data.
Description is now made of the conventional communication device which is provided with the transmission buffer.
FIG. 24 is a block diagram showing an example of the structure of a transmission portion in the conventional communication device. In FIG. 24, the communication device comprises a control portion 1010, a utilization portion 1020, a RAM (Random Access Memory) 1030, and an interface 1040.
The control portion 1010 executes a previously determined communication protocol. Although the utilization portion 1020 performs application processing, no service for using is specified on the communication protocol. That is, a user can use an arbitrary application program in the utilization portion 1020.
The RAM 1030 is used as a working memory of the control portion 1010 and the utilization portion 1020. The RAM 1030 has, as ones related to transmit data, a transmission buffer 1031, a transmit data management table 1032, and an untransmitted data management table 1033. The transmission buffer 1031 and the transmit data management table 1032 are under the management of the utilization portion 1020. On the other hand, the untransmitted data management table 1033 is under the management of the control portion 1010. The details of the transmission buffer 1031, the transmit data management table 1032, and the untransmitted data management table 1033 will be described later.
The control portion 1010 is connected to a communication line 1042 through the interface 1040. The interface 1040 includes a modem or the like, and mediates communication between the communication device shown in FIG. 24 and another communication device (not shown).
FIG. 25 is a diagram showing the structure of the transmission buffer 1031 shown in FIG. 24. Transmit data generated in the utilization portion 1020 is written into the transmission buffer 1031. In FIG. 25, eight transmit data are written, as an example, into the transmission buffer 1031.
FIG. 26 is a diagram showing the structure of the transmit data management table 1032 shown in FIG. 24. The location of each of the transmit data written into the transmission buffer 1031 is contained in the transmit data management table 1032 as shown in FIG. 25 (specifically, a head address in a write area of the each of the transmit data in the transmission buffer 1031).
FIG. 27 is a diagram showing the each of the structure of the untransmitted data management table 1033 shown in FIG. 24. The untransmitted data management table 1033 stores the location of each of the transmit data whose request for transmission has been accepted (a head address in a write area of the each of the transmit data in the transmission buffer 1031) and the size thereof. Further, a header information write area and an ender information write area are provided in relation to the location and the size of each of the transmit data.
FIG. 28 is a flow chart showing a part of operations performed by the utilization portion 1020 shown in FIG. 24. FIGS. 29 and 30 are flow charts showing parts of operations performed by the control portion 1010 shown in FIG. 24.
Referring now to FIGS. 28 to 30, description is made of a series of operations performed from the time when transmit data is generated until it is transmitted in the communication device shown in FIG. 24.
FIG. 28 will be referred to. The utilization portion 1020 judges, when transmit data is generated (step S2801), whether the transmission of the transmit data is the first transmission or the second or later transmission (step S2802). In the case of the first transmission, the utilization portion 1020 judges whether or not the transmit data management table 1032 has a space (step S2803). In the first transmission, the transmit data management table 1032 is empty, so that the result of the judgment is "YES", after which the program proceeds to the step S2804. At the step S2804, the utilization portion 1020 judges whether or not a write area in which transmit data is to be newly written can be ensured in the transmission buffer 1031. In the first transmission, the transmission buffer 1031 is empty, so that the result of the judgment is "YES", after which the program proceeds to the step S2805. At the step S2805, the utilization portion 1020 ensures a write area in which transmit data is to be newly written in the transmission buffer 1031, to add the location (a head address) of the ensured write area to the transmit data management table 1032. The utilization portion 1020 then writes transmit data generated at that time into the newly ensured write area in the transmission buffer 1031 (step S2806). The utilization portion 1020 then prepares a data transmission request (step S2807). The data transmission request includes the location of the transmit data newly written into the transmission buffer 1031 and the size thereof. The data transmission request is outputted to the control portion 1010 at the step S2808.
FIG. 29 will be referred to. The control portion 1010 adds, when it receives the data transmission request from the utilization portion 1020 (step S2901), the location and the size of the transmit data (both are included in the data transmission request) to the untransmitted data management table 1033 (step S2902). The control portion 1010 then writes header information of a packet to be later generated in a header information write area in the same column as a column to which the location and the size of the transmit data are added at the step S2902 (step S2903). Further, the control portion 1010 then writes ender information of the packet to be later generated in an ender information write area in the same column (step S2904). The control portion 1010 then judges whether or not the communication device is currently in a transmittable state (step S2905). Such judgment is required because the communication device shown in FIG. 24 makes half-duplex transmission, for example, so that it cannot transmit the transmit data while receiving transmit data from a communication device at the destination of communication (not shown). The control portion 1010 performs processing at the step S2906 immediately when transmission is possible, while performing the processing after waiting, when transmission is impossible, until there occurs a state where transmission is possible. At the step S2906, the control portion 1010 generates a packet for the oldest transmit data out of the transmit data, which have not been transmitted yet, registered in the untransmitted data management table 1033, and transmits the packet to the communication device at the destination of communication. The packet is constituted by header information, transmit data, and ender information. The header information and the ender information are taken out of the untransmitted data management table 1033. The transmit data is taken out of the transmission buffer 1031 (more specifically, out of a write area specified by the location of the transmit data stored in the untransmitted data management table 1033). The control portion 1010 then judges whether or not acknowledgment (ACK) of arrival of the transmit data is returned from the communication device at the destination of communication (step S2907). When the ACK is not returned, the program is returned to the step S2906. At the step S2906, the control portion 1010 generates and resends the same packet. On the other hand, when the ACK is returned, the control portion 1010 judges that the transmission of the packet is terminated, and deletes information, relating to the packet whose transmission is terminated (header information, the location of the transmit data, the size of the transmit data, ender information) from the untransmitted data management table 1033 (step S2908). The transmission processing in the control portion 1010 is thus terminated.
FIG. 28 will be referred to again. When transmit data is generated in the utilization portion 1020, the transmission of the transmit data at this time is the second or later transmission, so that the program proceeds to the step S2809. At the step S2809, the utilization portion 1020 requires confirmation of a status of the control portion 1010. The status indicates the situation where transmission processing in the control portion 1010 progresses.
FIG. 30 will be referred to. The control portion 1010 takes out, when it receives a status confirmation request from the utilization portion 1020 (step S3001), all the locations of the transmit data which are stored in the untransmitted data management table 1033, to produce a status (step S3002), and sends the produced status to the utilization portion 1020 (step S3003). The confirmation processing of the status in the control portion 1010 is thus terminated.
FIG. 28 will be referred to again. The utilization portion 1020 judges, when it receives the status from the control portion 1010, whether or not there is transmit data whose transmission in the control portion 1010 is completed out of the transmit data written into the transmission buffer 1031 (step S2810). This judgment is made by examining transmit data whose location is stored in the transmit data management table 1032 but does not exist in the status. When transmit data which has been already transmitted exists in the transmission buffer 1031, the utilization portion 1020 writes the transmit data into one of write areas storing the transmit data which has been already transmitted, and overwrites the location of the transmit data (a head address in the write area) on a corresponding column in the transmit data management table 1032 (step S2811). The utilization portion 1020 then deletes the location of transmit data whose transmission is confirmed at the foregoing step S2811 and other than the transmit data written this time into the transmission buffer 1031 (step S2812). The utilization portion 1020 then prepares a data transmission request (including the location and the size of the transmit data written at that time into the transmission buffer 1031) (step S2807). The data transmission request is outputted to the control portion 1010 at the step S2808.
On the other hand, when there exists no transmit data whose transmission is completed in the transmission buffer 1031 at the foregoing step S2810, the program proceeds to the step S2803. At the step S2803, the utilization portion 1020 judges whether or not the transmit data management table 1032 is empty. When the transmit data management table 1032 is not empty, the program is returned to the step S2809. At the step S2809, the utilization portion 1020 confirms the status in the control portion 1010 again. On the other hand, when the transmit data management table 1032 is empty, the utilization portion 1020 judges whether or not a write area in which transmit data is to be newly written can be ensured in the transmission buffer 1031 (step S2804). When a write area in which transmit data is to be newly written cannot be ensured, the program is returned to the step S2809. At the step S2809, the utilization portion 1020 confirms the status in the control portion 1010 again. On the other hand, when a write area in which transmit data is to be newly written can be ensured, the utilization portion 1020 ensures a write area in which transmit data is to be newly written in the transmission buffer 1031, and adds the location (a head address) of the ensured write area to the transmit data management table 1032 (step S2805). The utilization portion 1020 then writes transmit data generated at that time in the newly ensured transmit data write area in the transmission buffer 1031 (step S2806). The utilization portion 1020 then prepares a data transmission request (including the location and the size of the transmit data written at that time in the transmission buffer 1031) (step S2807). The data transmission request is outputted to the control portion 1010 at the step S2808. Operations, which respond to the data transmission request, performed by the control portion 1010 are the same as those in the case of the above-mentioned first transmission.
On the other hand, in a communication device comprising a utilization portion for performing arbitrary application processing, a control portion for performing processing in accordance with a previously determined protocol, and a memory which is shared between the utilization portion and the control portion, when data is received, the data received in the control portion is processed upon being transferred to the utilization portion. In the communication device, the overflow of the received data from the control portion may occur due to the delay of data processing in the utilization portion. Therefore, the conventional communication device employs a method of providing a receiving buffer in the control portion and temporarily storing the received data therein, to restrain the overflow of the received data.
In the conventional communication device employing the above-mentioned method will be described below.
FIG. 31 is a block diagram showing an example of the structure of a receiving portion in the conventional communication device. In FIG. 31, the communication device comprises a control portion 1011, a plurality of utilization portions 1021 to 102N, a RAM 10310, and an interface 1040.
The control portion 1011 executes a previously determined communication protocol. The control portion 1011 is connected to a communication line 1042 through the interface 1040. The interface 1040 includes a modem or the like, and mediates communication between the communication device shown in FIG. 31 and another communication device (not shown).
Although the utilization portions 1021 to 102N perform application processing, no service for using is specified on the communication protocol. That is, a user can use an arbitrary application program in the utilization portions 1021 to 102N.
The RAM 1030 is used as a working memory of the control portion 1011 and the utilization portions 1021 to 102N, and comprises a control portion management area 1051 which is managed by the control portion 1011 and utilization portion management areas 1091 to 109N which are respectively managed by the utilization portions 1021 to 120N. Further, the control portion management area 1051 comprises a first receiving buffer 1081, and second receiving buffers 1061 to 106N, respectively, corresponding to the utilization portions 1021 to 102N. The first receiving buffer 1081 has one record area, and data received under an instruction from the control portion 1011 is recorded on the one record area. Each of the second receiving buffers 1061 to 106N has a plurality of record areas, and the received data stored in the first receiving buffer 1081 is transcribed onto the plurality of record areas under an instruction from the control portion 1011, as required. The utilization portion management areas 1091 to 109N, respectively include data transcription areas 1091a to 109Na. The utilization portions 1021 to 102N transcribe utilization portion data which have been transcribed on the corresponding second receiving buffers 1061 to 106N onto the data transcription areas 1091a to 109Na, respectively.
Data transmitted and received in the conventional communication device takes a form called a packet. The packet is constituted by a header part, a data part and an ender part. In data transmitted with using the data part, there exist control portion data which is subjected to protocol processing in the control portion 1011 and utilization portion data which are respectively subjected to application processing in the utilization portions 1021 to 102N.
A series of operations performed from the time when data is received until application processing is performed in the communication device shown in FIG. 31 will be described using FIGS. 32 and 33. FIG. 32 is a flow chart showing processing steps carried out when the control portion 1011 receives data. FIG. 33 is a flow chart showing processing steps carried out by the control portion 1011 when busy communication from each of the utilization portions 1021 to 102N occurs.
FIG. 32 will be referred to. The control portion 1011 first writes, when data is received, the received data (actually, the data part of the received packet) into the first receiving buffer 1081 (step S3201). As the premise of the start of processing, the first receiving buffer 1081 and the second receiving buffers 1061 to 106N are initialized. The control portion 1011 judges whether or not the data part written into the first receiving buffer 1081 is utilization portion data (step S3202). In the judgment at the step S3202, when the data part is not utilization portion data, that is, control portion data, the control portion 1011 subjects the control portion data to protocol processing (step S3208), and deletes the control portion data from the first receiving buffer 1081 after the processing (step S3209).
On the other hand, in the judgment at the foregoing step S3202, when the data part is utilization portion data, the control portion 1011 transcribes the utilization portion data written into the first receiving buffer 1081 onto the corresponding second receiving buffer 106i (i=any one of 1 to N. The same shall apply hereinafter) (step S3203), and deletes the utilization portion data from the first receiving buffer 1081 (step S3204). Thereafter, the control portion 1011 judges whether or not the utilization portion 102i for processing the utilization portion data is in a busy state (a state where processing is being performed, and a new processing request cannot be accepted) with using a flag or the like (step S3205).
In the judgment at the step S3205, when the utilization portion 102i is not in a busy state, the control portion 1011 notifies the utilization portion 102i of the receiving of the location of the utilization portion data written into the second receiving buffer 106i (specifically, a head address in a write area of the received data) and the size thereof (step S3206). Thereafter, the control portion 1011 deletes the utilization portion data, of which the utilization portion 102i has been notified, from the second receiving buffer 106i (step S3207). The utilization portion 102i performs processing for transcribing utilization portion data onto the data transcription area 109ia managed by itself from the second receiving buffer 106i upon receipt of the notification of the receiving in a period elapsed from the processing at the step S3206 to the processing at the step S3207, which is not illustrated. On the other hand, when the corresponding utilization portion 102i is in a busy state in the judgment at the aforementioned step S3205, the control portion 1011 terminates the receiving processing.
Since the receiving processing was terminated because the utilization portion 102i was in a busy state, when the busy state in the utilization portion 102i is released, the control portion 1011 sends the above-mentioned notification of the receiving to the utilization portion 102i by communication relating to the busy state (hereinafter referred to as busy communication) from the utilization portion 102i, as shown in FIG. 33.
FIG. 33 will be referred to. The control portion 1011 judges, when it receives the busy communication from the utilization portion 102i, whether or not the communication is communication indicating that the utilization portion 102i is not in a busy state (step S3301). In a case where in the judgment at the step S3301, the communication is communication indicating that the utilization portion 102i is not in a busy state, the control portion 1011 further judges whether or not utilization portion data exists in the second receiving buffer 106i (step S3302). On the other hand, in a case where in the judgment at the step S3301, the communication is not communication indicating that the utilization portion 102i is not in a busy state, the control portion 1011 terminates the processing for the busy communication.
When the utilization portion data exists in the second receiving buffer 106i in the judgment at the aforementioned step S3302, the control portion 1011 notifies the utilization portion 102i of the receiving of the location, in which the utilization portion data is written, on the RAM 1030 and the size thereof (step S3303). Thereafter, the control portion 1011 deletes the utilization portion data from the second receiving buffer 106i (step S3304). It is also considered that the transition of the utilization portion 102i to the busy state immediately occurs by the notification made at the step S3303, so that the control portion 1011 reconfirms the contents of the busy communication after the utilization portion data is deleted at the step S3304 (step S3305). Therefore, the program is returned to the step S3301. At the step S3301, the confirmed contents of the communication are judged. In the case of the contents of the communication indicating that the utilization portion 102i is in a busy state, the processing for the busy communication is terminated. In the case of the contents of the communication indicating that the utilization portion 102i is not in a busy state, it is further judged whether or not the utilization portion data exists in the second receiving buffer 106i. The utilization portion 102i performs processing for transcribing the utilization portion data onto the data transcription area 109ia managed by itself from the second receiving buffer 106i upon receipt of the notification in a period elapsed from the processing at the step S3303 to the processing at the step S3304, which is not illustrated. On the other hand, when the utilization portion data does not exist in the second receiving buffer 106i in the judgment at the step S3302, the control portion 1011 terminates the processing for the busy communication.
As a method of restraining the overflow of the received data, the communication device which is provided with the second receiving buffer 106i was described. In a case where data, whose amounts are not less than the size of the receiving buffer 106i, are transmitted to the communication device, however, even if the data is received, the data cannot be written into the second receiving buffer 106i. As a result, deficiency of the data arises.
In order to cope therewith, there is such a method that a communication device on the receiving side communicates the total amount of data which can be stored in a buffer (corresponding to the part of the second receiving buffer 106i in FIG. 31) even if the utilization portion 102i is in a busy state to a communication device on the transmission side before communication is started in the form of a credit value as described later.
This method utilizes the fact that the maximum size of data in a communication packet (which is the maximum value of data which can be carried in one packet transmission) is previously determined in the stages of the construction of a communication system. Specifically, the size of an area in the RAM 1030 which can store received data, that is, the second receiving buffer 106i divided by the maximum data size is found. The communication device on the receiving side communicates the result of the division to the communication device on the transmission side before communication is started as the number of times packet receiving (packet transmission on the receiving side) can be continuously made. A value representing the number of times packet receiving (transmission) can be continuously made is referred to as a credit value. Particularly, its maximum value is referred to as the maximum credit value. The communication device on the transmission side which has received the maximum credit value decreases the credit value by one at a time by itself every time it transmits one packet, to stop the packet transmission at the time point where the credit value becomes zero. The communication device on the transmission side waits until the subsequent credit value is communicated from the communication device on the receiving side. Consequently, the communication device on the receiving side does not unuselessly receive data not less than the allowable amount of data which can be processed by itself (stored in the receiving buffer), so that deficiency of the received data can be prevented from arising, for example.
As described in the foregoing, in the conventional communication device, the transmission buffer 1031 is managed by the utilization portion 1020. However, the transmission processing of the transmit data is performed in the control portion 1010, so that the utilization portion 1020 cannot directly know which of the transmit data in the transmission buffer 1031 has been transmitted. In the conventional communication device, therefore, the control portion 1010 judges which of the transmit data whose request for transmission has been accepted has not been transmitted yet, manage the judgment using the untransmitted data management table 1033, and transmits the result of the management to the utilization portion 1020 as a status. Consequently, the utilization portion 1020 can know which of the transmit data in the transmission buffer 1031 has been transmitted, and can write new transmit data in a portion storing the transmit data.
In the above-mentioned configuration, however, every time transmit data is newly generated, the utilization portion 1020 must inquire a status of the control portion 1010, and the control portion 1010 must produce a status on the basis of the data recorded on the untransmitted data management table 1033 in response to the inquiry and send the produced status to the utilization portion 1020. Further, the utilization portion 1020 must manage the location of the transmit data in the transmission buffer 1031 by using the transmit data management table 1032, to specify the location of a write area storing transmit data which has been transmitted in the transmission buffer 1031 from the sent status. Therefore, the conventional communication device requires complicated processing for managing the transmission buffer 1031, so that a load on the whole communication device becomes heavy because the transmission buffer 1031 is managed in a distributed manner by the utilization portion 1020 and the control portion 1010.
In the conventional communication device, the utilization portion 1020 is in charge of a part of the management of the transmission buffer 1031, so that a processing load on the utilization portion becomes heavy. As a result, a large amount of time and high cost are required to develop a new application program. Since the application program includes processing other than the processing originally expected, it cannot be expected that the processing originally expected is quickly performed, so that the communication device is inconvenient for a user.
On the other hand, in the conventional communication device, two receiving buffers, that is, the first receiving buffer 1081 (for receiving of data and assignment to the control portion/the utilization portions) and the second receiving buffers 1061 to 106N (for storing utilization portion data as anti-overflow measures) are interposed before the received utilization portion data is subjected to application processing in the utilization portions 1021 to 102N. In the aforementioned conventional communication device, therefore, two data transcription (data transcription from the first receiving buffer 1081 to the second receiving buffers 1061 to 106N, and data transcription from the second receiving buffers 1061 to 106N to the data transcription areas 1091a to 109Na) are required in processing one received data. Consequently, the conventional communication device is inferior in communication throughput.
In the above-mentioned conventional communication device, the size of the second receiving buffer 106i is identical and fixed under the management of the control portion 1011 irrespective of different objects and processing capabilities of the utilization portions 1021 to 102N. Therefore, the size of the second receiving buffer 106i is too large and useless depending on the utilization portion 102i, while being too small, causing deficiency of data in some cases.
Furthermore, the conventional communication device which communicates the above-mentioned credit value, the fixed size of the second receiving buffer 106i is divided by the previously determined maximum data size in the communication packet, thereby finding the maximum credit value. Therefore, the maximum credit value is a constant value, although the data size varies for each communication, so that no efficient and most suitable data communication is established depending on communication.